package com.bmc.ccproblem;

/**
 * In graph terminology it is a vertex.
 */
public class DataPoint implements Comparable<DataPoint> {

    private final String id;

    public DataPoint(String id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        return 31 + ((id == null) ? 0 : id.hashCode());
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null || getClass() != obj.getClass())
            return false;
        DataPoint other = (DataPoint) obj;
        if (id == null && other.id != null)
            return false;
        return id.equals(other.id);
    }

    public int compareTo(DataPoint other) {
        return id.compareTo(other.id);
    }

    @Override
    public String toString() {
        return id;
    }
}
